/**
 * 封装评论模块请求
 */
import request from '@/utils/request'

export const getComment = params => {
  return request({
    method: 'GET',
    url: '/v1_0/comments',
    params
  })
}

export const addOrDelLike = (addOrdel, target) => {
  if (addOrdel) {
    return request({
      method: 'DELETE',
      url: '/v1_0/comment/likings/' + target
    })
  } else {
    return request({
      method: 'POST',
      url: '/v1_0/comment/likings',
      data: {
        target
      }
    })
  }
}

export const sendComments = data => {
  return request({
    method: 'POST',
    url: '/v1_0/comments',
    data
  })
}
